<template>
    <h2>登录页面</h2>
    <table>
        <tr>
            <td>登录名称</td>
            <td>
                <input type="text" placeholder="请输入登录的账户" v-model="info.Uname">
            </td>
        </tr>
        <tr>
            <td>登录密码</td>
            <td>
                <input type="text" placeholder="请输入登录的密码" v-model="info.Upwd">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="登录" @click="login">
            </td>
        </tr>
    </table>
</template>
<script setup lang="ts">
import axios from 'axios'
import {ref} from  'vue'

const info=ref({
    Uname:"",
    Upwd:""
})

const login=()=>{
    axios({
        url:"http://localhost:52230/Users/login",
        method:"get",
        params:{
            username:info.value.Uname,
            userpwd:info.value.Upwd
        }
    })
    .then(function(res){
        if(res.data==-1){
            alert("用户名不存在")
        }
        if(res.data==-2){
            alert("密码不正确")
        }else{
            alert("ok")
        }
        
        console.log(res.data)
    })
}

</script>